package com.su.lightthings.fragment

import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.GridLayoutManager
import com.su.lightthings.adapter.SportPageItemAdapter
import com.su.lightthings.base.BaseFragment
import com.su.lightthings.databinding.FragmentSportBinding
import com.su.lightthings.utils.Cons
import com.su.lightthings.view.LinearSpacingItemDecoration

class SportFragment : BaseFragment<FragmentSportBinding>() {

    private val mAdapter: SportPageItemAdapter by lazy {
        SportPageItemAdapter()
    }

    override fun getViewBinding(inflater: LayoutInflater, container: ViewGroup?): FragmentSportBinding = FragmentSportBinding.inflate(layoutInflater)

    override fun initViews() {
        binding.rv.apply {
            adapter = mAdapter
            layoutManager = GridLayoutManager(requireContext(), 2)
            isNestedScrollingEnabled = false
            addItemDecoration(LinearSpacingItemDecoration(top = 10, bottom = 10, left = 15, right = 15))

        }

        mAdapter.submitList(Cons.SportPage.sportItemList)
    }

}